<?php
require_once '../class/Include.php';

$tab_data = array();
$tab_temp = array();
$tab_data['users'] = array();

			
$partId = 1;//$_POST['id'];
$partition = Partition::get($partId);

if (!is_null($partition)){
	$tab_data['partId'] = $partId;
	$concert = $partition->getConcert();
	if (!is_null($concert)){
		$tab_temp = $concert->getListUserinstrumentconcertWhereconcertId();
		
		$i = 1;
		foreach ($tab_temp as $userInstrumentConcert) {
			$user = $userInstrumentConcert->getUser();
			if (!is_null($user)){
				$tab_data['users'][$i]['id'] = $user->getId();
				$tab_data['users'][$i]['instrument'] = '';				
				$tab_data['users'][$i]['UICName'] = $userInstrumentConcert->getNom();

				
				$tmp = $userInstrumentConcert->getInstrument();
				if ($userInstrumentConcert->getRole()==1){ //Chef d'Orchestre
					$tab_data['users'][$i]['instrument'] = 'Chef d\'Orchestre';
				}else{
					if(!is_null($tmp)){
						$tab_data['users'][$i]['instrument'] = $tmp->getNom();
					}			
				}
			}
			$i++;
		}
		
	}
}
// echo(($tab_data));

echo(json_encode($tab_data));

?>